package org.ch00.test06;

import java.util.Random;

/**
 * @author ZJL
 * @date 2025-03-03
 */
public class Hunter {
    public void goHunting(Animal animal) {
        System.out.println("猎人正在打猎...");
        animal.run();
        Random rand = new Random();
        int i = rand.nextInt(2);
        if (i==1){
            System.out.println("打中了！！！");
        }else{
            System.out.println("跑掉了。");
        }
    }
}
